<?php

use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return view('auth.login');
});

Auth::routes();

Route::post('/login', 'Auth\AdminController@login')->name('admin-login')->middleware('guest');

Route::get('/home', 'HomeController@index')->name('home')->middleware('auth');

Route::group(['middleware' => 'auth'], function () {

    Route::get('user', 'UserController@index')->name('user');
    Route::get('user/{id}', 'UserController@update');

    Route::get('craftsman', 'CraftsmanController@index')->name('craftsman');
    Route::get('craftsman/{id}', 'CraftsmanController@update');

    Route::prefix('apply')->group(function ()
    {
        Route::get('/', 'ApplyController@index')->name('apply');
        Route::get('/{id}/{status?}', 'ApplyController@update');
    });

    Route::prefix('goods')->group(function ()
    {
        Route::get('/', 'GoodsController@index')->name('goods');
        Route::get('/{id}', 'GoodsController@destroy');
    });

    Route::prefix('bid')->group(function ()
    {
        Route::get('/', 'BidGoodsController@index')->name('bid');
        Route::get('/{id}', 'BidGoodsController@destroy');
    });

    Route::prefix('blog')->group(function ()
    {
        Route::get('/', 'BlogController@index')->name('blog');
        Route::get('/{blog}/{recommend?}/{action?}', 'BlogController@update');
    });

    Route::prefix('note')->group(function ()
    {
        Route::get('/', 'NoteController@index')->name('note');
        Route::get('/{note}', 'NoteController@destroy');
    });

    Route::prefix('zone')->group(function ()
    {
        Route::get('/', 'ZoneController@index')->name('zone');
        Route::post('/', 'ZoneController@create');
    });

});
